﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MDK.Common
{
    public class EventHelper
    {
        public static Dictionary<string, EventHandler> handlers = new Dictionary<string, EventHandler>();

        public static void Add(string name, EventHandler handler)
        {
            if (!handlers.ContainsKey(name))
                handlers.Add(name, handler);
        }

        public static void Remove(string name)
        {
            if (handlers.ContainsKey(name))
                handlers.Remove(name);
        }

        public static void Rasie(string name, Dictionary<string, object> dic)
        {
            if (handlers.ContainsKey(name))
                handlers[name].Invoke(dic, null);
        }
    }

}
